package com.ostrich.cloud.ostrichUserWeb.client;


import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichUserWeb.client.userparam.CusPasswordWebParam;
import com.ostrich.cloud.ostrichUserWeb.client.userparam.LoginCusWebParam;
import com.ostrich.cloud.ostrichUserWeb.client.userparam.RegCustomerWebParam;
import com.ostrich.cloud.ostrichUserWeb.client.userparam.UpdateCusWebParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


import java.io.IOException;
import java.math.BigDecimal;

/**
* name是项目名，contextId是client的名字
*/
@FeignClient(contextId = "customerWebMangerClient",name="ostrichUserWeb")
@Api("用户相关接口")
public interface CustomerWebMangerClient {

    @PostMapping("doRegister")
    public Result customerRegister(@RequestBody  RegCustomerWebParam regCustomerWebParam);

    @PostMapping("uploadCusImg")
    @ApiOperation("上传图片")
    public Result uploadCusImg(@RequestBody MultipartFile file) throws IOException;

    @ApiOperation("修改用户个人信息")
    @PostMapping("updateCusMessage")
    public Result updateCusMessage(@RequestBody UpdateCusWebParam updateCusWebParam);

    @GetMapping("getCusMessage")
    @ApiOperation("获取用户个人信息")
    public Result getCusMessage();

//    @GetMapping("getAllCusMessage")
//    @ApiOperation("获取所有的用户信息")
//    public Result getAllCusMessage(@RequestParam("current") Integer current
//            , @RequestParam("size") Integer size, @RequestParam("status") String status);

    @PostMapping("doLogin")
    @ApiOperation("顾客登录的接口")
    public Result customerLogin(@RequestBody LoginCusWebParam loginCusWebParam);

    @PutMapping("cusPasswordUp")
    @ApiOperation("修改用户密码")
    public Result cusPasswordUp(@RequestBody CusPasswordWebParam cusPasswordWebParam);

    @GetMapping("upCusStatus")
    @ApiOperation("修改用户状态")
    public Result upCusStatus(@RequestParam("parentId") Integer parentId
            , @RequestParam("status") String status);

    /*
      支付宝充值
     */
    @GetMapping("/alipay/pay") // &subject=xxx&traceNo=xxx&totalAmount=xxx
    @ApiOperation("支付功能")
    public Result pay(@RequestParam("price") Double price);

    @PutMapping("updateMoney")
    @ApiOperation("修改用户余额")
    public Result updateMoney(@RequestParam("price") BigDecimal price);


    @ApiOperation("获取附近10km的商家")
    @GetMapping("getAllBusinessByLocation")
    public Result getAllBusinessByLocation(@RequestParam("latitude") String latitude,
                                           @RequestParam("logitude")  String logitud,
                                           @RequestParam("radius") Double radius);


    @GetMapping("getOneBusinessByLocation")
    @ApiOperation("获取附近最近的一个商户")
    public Result getOneBusinessByLocation(@RequestParam("latitude") String latitude,
                                           @RequestParam("logitude")  String logitud);



}
